package org.csu.spring.demo.ioc.test;

import org.csu.spring.demo.ioc.domain.Account;
import org.csu.spring.demo.ioc.persistence.AccountDAO;
import org.csu.spring.demo.ioc.persistence.AccountDAOImpl;
import org.csu.spring.demo.ioc.service.AccountService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class Demo {

    @Autowired
    private AccountService service;

    @Test
    public void test(){
//        AccountDAO accountDAO = new AccountDAOImpl();
//        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
//        AccountService service = (AccountService) context.getBean("accountService");
        service.login();
    }
}
